package ${packageName};

import com.zxn.presenter.view.BaseActivity;
import android.os.Bundle;
import android.content.Context;
import android.content.Intent;
<#if applicationPackage??>
import ${applicationPackage}.R;
</#if>
<#if includeCppSupport!false>
</#if>
/**
 *	
 * Created by zxn on ${.now}.
 */
public class ${activityClass} extends BaseActivity {

    private static final String ARG_PARAM1 = "param1";
    private String mParam1;

    @BindView(R.id.rv)
    RecyclerView ${generateRv("${activityClass}")};
    //@BindView(R.id.srl_refresh_layout)
    //SmartRefreshLayout srlRefreshLayout;

    private ${generateAdapter("${activityClass}")} mAdapter;

	public static void jumpTo(Context context,String param1) {
        Intent intent = new Intent(context, ${activityClass}.class);
        intent.putExtra(ARG_PARAM1, param1);
        context.startActivity(intent);
    }

    public static void jumpTo(Context context) {
        Intent intent = new Intent(context, ${activityClass}.class);
        context.startActivity(intent);
    }

    @Override
    protected int getLayoutResId() {
        return R.layout.${layoutName};
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
		mParam1 = getIntent().getStringExtra(ARG_PARAM1);
		onCreateRecyclerView();
	<#if addTitleRight>
		onCreateTitleView();
	</#if> 	
    }

    private void onCreateRecyclerView() {
        ${generateRv("${activityClass}")}.setLayoutManager(new LinearLayoutManager(mContext));
        ${generateRv("${activityClass}")}.setHasFixedSize(true);
        ${generateRv("${activityClass}")}.addItemDecoration(new RvItemDecoration.Builder(this)
                .bgColor(R.color.colorPrimary)
                .widthDp(10f)
                .setOrientation(LinearDecoration.VERTICAL)
                .createLinear());
                
        mAdapter = new ${generateAdapter("${activityClass}")}();      
        ${generateRv("${activityClass}")}.setAdapter(mAdapter);
        
        /*mAdapter.setOnItemClickListener((adapter, view, position) -> {

        });*/
        
        /*mAdapter.setOnItemChildClickListener((adapter, view, position) -> {
            
        });*/
        //mAdapter.setNewData(new ArrayList<>());
        
        /*srlRefreshLayout.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
            @Override
            public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
                
            }

            @Override
            public void onRefresh(@NonNull RefreshLayout refreshLayout) {

            }
        });
        srlRefreshLayout.autoRefresh();*/
    }
 
}

<#if addTitleRight>
    private void onCreateTitleView() {
    <#if titleRightStyle == 'image'>
        ImageView view = new ImageView(mContext);
        view.setImageResource(R.drawable.ic_back_white);
	<#else>
        TextView view = new TextView(mContext);
        view.setText(R.string.${titleRightName});
        view.setTextColor(UIUtils.getColor(R.color.c_ffffff));
        view.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15);		
	</#if>		     
        view.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
        titleView.addRightView(view);
    }
</#if> 

<#function generateRv activityClass>
  <#return "m" + activityClass?replace("Activity", "Rv")>
</#function>

<#function generateAdapter activityClass>
  <#return activityClass?replace("Activity", "Adapter")>
</#function>
